home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
et
/
et-2_2.lha
/
et2.2
/
src
/
ObjInt.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-07-19
|
782b
|
52 lines
//$ObjInt$
#include "ObjInt.h"
#include "String.h"
MetaImpl(ObjInt, (T(val), 0));
//---- an integer object -------------------------------------------------------
unsigned long ObjInt::Hash()
{
return (unsigned long) val;
}
bool ObjInt::IsEqual(Object* op)
{
return op->IsKindOf(ObjInt) && val==((ObjInt*)op)->val;
}
int ObjInt::Compare(Object* op)
{
return val - Guard(op, ObjInt)->val;
}
Object *ObjInt::DeepClone()
{
return new ObjInt(val);
}
char* ObjInt::AsString()
{
return form("%d", val);
}
ostream& ObjInt::PrintOn(ostream &s)
{
Object::PrintOn(s);
return s << val SP;
}
istream& ObjInt::ReadFrom(istream &s)
{
Object::ReadFrom(s);
return s >> val;
}
void ObjInt::InspectorId(char *buf, int)
{
sprintf(buf, "%d", val);
}